home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 1 / Atari Mega Archive - Volume 1.iso / tex / meta27 / mfpandor.lzh / number.mf < prev    next >
Text File  |  1990-11-16  |  18KB  |  469 lines

  1. %*****************************************************************************
  2. %        Copyright (c) 1989 by N. N. Billawala
  3. %*****************************************************************************
  4.  
  5.  
  6. % number.mf numerals
  7. % 10 characters
  8.  
  9.  
  10. iff OK "0":  "The number 0";  
  11.   beginchar("0",num_width_c#+c_mono#,cap#,0);      
  12.   if mono<>0:save circ; circ1=circ2=circ3=1.05; fi
  13.  
  14.   top z1=(h_stress*w,h+ov_t.uc)//;
  15.   lft z2=(0,(1-v_stress)*h)//;
  16.   bot z3=((1-h_stress)*w,-ov_b.uc)//;
  17.   rt z4=(w,v_stress*h)//;
  18.  
  19.   circular_shape(y1,y3,x2,x4,minor_curve.uc,bowlstem.uc); 
  20.  
  21.  showpoints(1,2,3,4);
  22. adjust(.5num_fit_c#+m_a*c_mfit#,.5num_fit_c#+m_a*c_mfit#); 
  23. show_character; endchar;
  24.  
  25.  
  26. iff OK "1":  "The number 1";  
  27.   beginchar("1",num_width_a#+b_mono#,cap#,0); 
  28.  
  29.   save_num(terminal_thickness)=max(.75thin_stem.uc,.3stem.uc);
  30.   bot z40=(.5w,0);        multpos(1,4,40)(stem.uc,0);      
  31.   lft x4l=round x40l;     bot y4=0;   
  32.   top z1=(x4,h)//; 
  33.   onaline(1l,4l)(2l,3l);  y3l=y3r=cap_bracket_h;           
  34.   onaline(1r,4r)(2r,3r);  y2r=y2l=max(h-cap_bracket_h,y3l); 
  35.   y2l:=min(y2l,h-terminal_thickness-(stem.uc*sind max(25-.5oblique,0)));
  36.  
  37.   p1=fullserif(z4,z1,z3l,z3r,1.25hs,1.25hs)--
  38.      terminalserif.l(z1,z4,z2l,z2r,1.5pt,max(25-.5oblique,0))--cycle;
  39.  
  40.   showpoints(1,2,3,4);
  41. adjust(.5num_fit_a#+m_a*b_mfit#,.5num_fit_a#+m_a*b_mfit#);
  42. show_character; endchar;
  43.  
  44.  
  45.  
  46.  
  47. def character_points=
  48. iff OK "2":  "The number 2"; 
  49.   beginchar(50+alt8,num_width_b#+b_mono#,cap#,0); 
  50.  
  51.   twotension:=10;
  52.   z1=(.05w,.9h)//;
  53.   rt z3r=(w,if inflection_two:.75h else:.7h fi)//;lft z3l=(z3r-(bowlstem.uc,0));
  54.   top y2r=bot y2l+max(1,major_curve.uc)=h+ov_t.uc; 
  55.   good_x_for(2r)(z1,z3r,.5)a; good_x_for(2l)(z1+(bulb_thickness,0),z3l,.5)b;
  56.   top lft z5l=(0,max(1,.9stem.uc))//;   
  57.   z4l=.5[z5l,z3l];                      
  58.   bot lft z6l=(0,0); z6r=z6l+(0,apex.uc)//;  
  59.   bot rt z8=(.95w,0);
  60.   bot y7l=top y7r-max(1,.9stem.uc)=0;
  61.   good_x_for(7l)(z6l,z8,.5)c; good_x_for(7r)(z5r,z8-(tip_thickness,0),.5)d;
  62.  
  63.   ref1=(z6r-(0,max(1,.8thin_stem.uc)))
  64.         ..tension atleast twotension and 1..z3r{upward};
  65.   ref2=z3l{downward}..tension atleast 1 and twotension..z6r; 
  66.   ref3=(-1,y7r)--(w,y7r);
  67.   ref4=z3l{downward}...z4l...z6r{downward}...z6l; 
  68.  
  69.   if inflection_two: 
  70.     rt z5r=ref4 intersectionpoint ref3+(1.3thin_stem.uc,0);  z4r=.5[z5r,z3r]; 
  71.     p1=(bulb.tl(z1,z2l,z2r,cs,bulb_thickness,90)soft i_t 
  72.         ref4 if softpath:)softjoin(z6l fi
  73.        --arm.br(z8,z7r,z7l,.5as,.75tip_thickness,90-arm_angle+.5oblique)soft--
  74.         z5r  if softpath:)softjoin(z5r fi 
  75.        {upward}..z4r...z3r{upward} o_t z2r{left})--cycle;
  76.    else:
  77.      rt z5r=ref1 intersectionpoint ref3; 
  78.      (t1,t2)=ref1 intersectiontimes ref3;
  79.      p1=(bulb.tl(z1,z2l,z2r,cs,bulb_thickness,90)soft i_t 
  80.         ref2 soften(z6r,z6l) 
  81.         arm.br(z8,z7r,z7l,.5as,.75tip_thickness,90-arm_angle+.5oblique)soft--z5r
  82.         if softpath:)softjoin(z5r fi
  83.       --subpath(t1,infinity)of ref1 o_t z2r{left})--cycle;
  84.    fi
  85.   showpoints(1,2,3,4,5,6,7,8);
  86.   adjust(.5num_fit_b#+m_a*b_mfit#,.5num_fit_b#+m_a*b_mfit#); 
  87.   show_character; endchar;
  88.  enddef;
  89.  
  90.  def number_two=save a,b;
  91.   vardef a=condition(inflection_two)t; testing_codes; character_points; enddef; 
  92.   vardef b=condition(inflection_two)f; testing_codes; character_points; enddef;
  93.   if test_all_characters:a;b;else:if inflection_two:a;else:b;fi fi
  94.  enddef;
  95.  
  96.  number_two;  save number_two;
  97.  
  98.  
  99.  
  100.  def three_diagonal_top(expr addtocode)=
  101. iff OK "3":  "The number 3"; 
  102.   beginchar(51+alt6+addtocode,num_width_b#+b_mono#,cap#,0);
  103.  
  104.   top z1=(0w,h)//;
  105.   lft z9=(0,.05h)//;  
  106.   bot lft z10r=(.05w,-ov_b.uc)//; 
  107.   pos10(minor_curve.uc,-90-oblique); 
  108.   z5=if open_tail:(.2w,.57h)//;else:(.3w,.55h)//; fi
  109.   z3r=(round(.97w),h-apex.uc)//;      
  110.   z40=(.97w,h)//;
  111.   x5r=x5+.45thin_stem.uc*(cosd (90-oblique));
  112.   x5l=x5r-.9thin_stem.uc*(cosd (90-oblique));
  113.   top y2r=bot y2l+max(1,.9stem.uc)=h;
  114.   top y6r=top y5r=round(y5+.45thin_stem.uc);
  115.   bot y6l=bot y5l=y5r-max(1,.9thin_stem.uc);
  116.   bot y8r=top y8l-minor_curve.uc=-ov_b.uc;  
  117.   z4l=z5r;
  118.   if open_tail:rt z7r=(w,.65[y8r,y6r])//; 
  119.                lft z7l=(x7r-stem.uc,.65[y8l,y6l]);
  120.           else:rt z7r=(w,v_stress[y8r,y6r])//;
  121.                lft z7l=(x7r-stem.uc,v_stress[y8l,y6l]);    fi
  122.  
  123.   numeric theta[],phi[],d[]; 
  124.     d1=thin_stem.uc;   
  125.     theta1=angle(length(z3r-z5r) +-+ d1,d1);  
  126.     phi1=angle(z3r-z5r)-theta1;
  127.   multpos(3,4)(thin_stem.uc,phi1-90);  
  128.  
  129.   onaline(3l,4l)(41); y41=y2l;
  130.   onaline(3r,4r)(42); y42=y5r;
  131.   good_x_for(2r)(z1,z40,.4)a;  good_x_for(2l)(z1+(bulb_thickness,0),z41,.4)b;
  132.   good_x_for(6r)(z42,z7r,.2)c; good_x_for(6l)(z5l,z7l,.3)d;                
  133.   good_x_for(8r)(z9,z7r,.4)e;  good_x_for(8l)(z9+(bulb_thickness,0),z7l,.4)f;  
  134.  
  135.   p1=(arm.tl(z1,z2l,z2r,.5as,.5tip_thickness,90)soft
  136.       soften(z41,z5r,z5l) z6l{right} i_t z7l{downward} i_t 
  137.       if open_tail:{-(dir (7*h/w))}z10l--z10r{dir(7*h/w)} 
  138.               else:bulb.bl(z9,z8l,z8r,.75cs,.75bulb_thickness,90)      fi
  139.       o_t z7r{upward} o_t z6r{left} soften(z42,z3r,z40) z2r)--cycle;
  140.  
  141.   showpoints(1,2,3,4,5,6,7,8,9,10,40,41,42);
  142.   adjust(.5num_fit_b#+m_a*b_mfit#,.5num_fit_b#+m_a*b_mfit#); 
  143.   show_character; endchar;
  144.  enddef;
  145.  
  146.  def three_round_top(expr addtocode)=
  147. iff OK "3":  "The number 3"; 
  148.   beginchar(51+alt6+addtocode,num_width_b#+b_mono#,cap#,0);
  149.  
  150.   z1=(.05w,.95h)//;  
  151.   lft  z9=(0,.05h)//;
  152.   bot lft z10r=(.05w,-ov_b.uc)//; 
  153.   pos10(minor_curve.uc,-90-oblique); 
  154.   z5=(.3w,.55h)//;  
  155.   x5r=x5+.45thin_stem.uc*(cosd (90-oblique));
  156.   x5l=x5r-.9thin_stem.uc*(cosd (90-oblique));
  157.   top y2r=bot y2l+minor_curve.uc=h+ov_t.uc;
  158.   top y4r=top y5r=round(y5+.45thin_stem.uc);
  159.   bot y4l=bot y5l=y5r-max(1,.9thin_stem.uc);
  160.   y6=.75[y5l,y5r];
  161.   bot y8r=top y8l-major_curve.uc=-ov_b.uc;  
  162.   rt z3r=(round(.97w),v_stress[y6,y2r])//;
  163.   lft z3l=(x3r-stem.uc,v_stress[y5r,y2l]);
  164.   if open_tail:rt z7r=(w,.65[y8r,y6])//; 
  165.                     lft z7l=(x7r-stem.uc,.65[y8l,y4l]);
  166.                else:rt z7r=(w,v_stress[y8r,y6])//;
  167.                     lft z7l=(x7r-stem.uc,v_stress[y8l,y4l]);    fi
  168.   z3=.5[z3l,z3r];     
  169.  
  170.   good_x_for(2r)(z1,z3r,.5)a;  good_x_for(2l)(z1+(bulb_thickness,0),z3l,.5)b;
  171.   good_x_for(4r)(z5r,z3l,.4)c; good_x_for(4l)(z5l,z7l,.4)d;                
  172.   good_x_for(6)(z5,z3,.6)e;                                  
  173.   good_x_for(8r)(z9,z7r,.4)g;  good_x_for(8l)(z9+(bulb_thickness,0),z7l,.4)f;  
  174.  
  175.   p1=(bulb.tl(z1,z2l,z2r,1.2cs,.75bulb_thickness,90)soft i_t
  176.       z3l{downward} i_t z4r{left} soften(z5r,z5l) z4l{right} i_t z7l{downward}
  177.       i_t  if open_tail:{-(dir (7*h/w))}z10l--z10r{dir(7*h/w)} 
  178.        else:bulb.bl(z9,z8l,z8r,.75cs,.75bulb_thickness,90)      fi
  179.       o_t z7r{upward} o_t 
  180.       z6{left}--(z6+(0,epsilon){right} o_t z3r{upward} o_t z2r{left}))--cycle;
  181.  
  182.   showpoints(1,2,3,4,5,6,7,8,9);
  183.   adjust(.5num_fit_b#+m_a*b_mfit#,.5num_fit_b#+m_a*b_mfit#); 
  184.   show_character; endchar;
  185.  enddef;    
  186.  
  187.  
  188.  vardef number_three=save first,second,third,fourth,addtocode;
  189.   addtocode:=-1;
  190.   vardef first=condition(diagonal_three)t; condition(open_tail)t; 
  191.            testing_codes; three_diagonal_top(0); enddef;
  192.   vardef second=condition(diagonal_three)t; condition(open_tail)f; 
  193.            testing_codes; three_diagonal_top(incr addtocode); enddef;
  194.   vardef third=condition(diagonal_three)f; condition(open_tail)t; 
  195.            testing_codes; three_round_top(incr addtocode+alt7); enddef;
  196.   vardef fourth=condition(diagonal_three)f; condition(open_tail)f; 
  197.            testing_codes; three_round_top(incr addtocode); enddef;
  198.  
  199.   if test_all_characters:first;second;third;fourth;
  200.    elseif diagonal_three and open_tail:first;
  201.    elseif diagonal_three and (not open_tail):second;  
  202.    elseif (not diagonal_three) and open_tail:third;
  203.    elseif (not diagonal_three) and (not open_tail):fourth;    fi
  204.  enddef;
  205.  
  206.  number_three;  save number_three,three_diagonal_top,three_round_top;
  207.  
  208.  
  209.  
  210. iff OK "4":  "The number 4"; 
  211.   beginchar(52+alt10,num_width_e#+.5*(d_mono#+e_mono#),cap#,0);
  212.  
  213.   min_limit(join_radius)(.5minor_curve.uc); 
  214.   top rt z11r=(round(.82w),h)//;     multpos(11,13)(max(1,stem.uc),0);
  215.   rt z13r=(round(.82w),0);      
  216.   bot lft z4l=(0,round(.2h))//;      pos4(apex.uc,90-apex_angle);
  217.   onaline(11r,13r)(10r,12r,23,25);   
  218.   onaline(11l,13l)(12l,20